<template>
  <div class="employee-container">
    <div style="background: #faf0e6;opacity: .8;margin-top:-10px;height: 30px">
      <el-row>
        <el-breadcrumb separator-class="el-icon-arrow-right">
          <el-breadcrumb-item :to="{ path: '../shouYe' } "style="margin-top: 5px;margin-left: 30px;">首页
          </el-breadcrumb-item>
          <el-breadcrumb-item style="margin-top: 5px;" >
            <i class="el-icon-office-building" aria-hidden="true"></i>
            业务信息
          </el-breadcrumb-item>
          <el-breadcrumb-item  style="margin-top: 5px;">
            <i class="fa fa-book" aria-hidden="true"></i>
            平台业务
          </el-breadcrumb-item>
        </el-breadcrumb>
      </el-row>
    </div>

    <el-row>
      <el-form label-width="80px">
        <el-row>
          <el-col :span="8" style="margin-top: 10px">
            <el-form-item label="平台业务" label-width="80px">
              <el-input style="height: 8%"/>
            </el-form-item>
          </el-col>
          <el-col :span="8" style="margin-top: 10px">
            <el-form-item label="所属类别" label-width="90px">
              <el-input></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8" style="margin-top: 10px">
            <el-form-item>
              <el-button type="success" style="background-color: cornflowerblue">
                <i class="fa fa-search" aria-hidden="true"></i>
                搜索Search
              </el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-row>
    <el-row>
      <div>
        <el-button-group>
          <el-button @click="btnAddClick" type="primary" icon="el-ico-edit" style="text-align: center">添加</el-button>
          <el-button type="warning" icon="el-icon-share">修改</el-button>
          <el-button   type="danger" icon="el-icon-delete">删除</el-button>
        </el-button-group>
      </div>
      <el-table :data="tableData"
                border
                stripe
                style="width :100%;height: 60%">

        <i class="fa fa-map-marker" aria-hidden="true"> </i>
        <el-table-column

          prop="id"
          label="编号"
          width="180"
          sortable
        >  </el-table-column>
        <el-table-column
          prop="gender"
          label="菜鸟寄件"
        ></el-table-column>
        <el-table-column
        prop="pick"
        label="菜鸟取件"
      ></el-table-column>

        <el-table-column
          prop="department"
          label="进口包裹服务"
        ></el-table-column>
        <el-table-column
          prop="export"
          label="出口包裹服务"
        ></el-table-column>

      </el-table>

      <el-button-group>
        <el-button type="primary" icon="el-icon-arrow-left">上一页</el-button>

        <el-button type="primary">下一页<i class="el-icon-arrow-right el-icon--right"></i></el-button>
      </el-button-group>

    </el-row>

    <el-dialog
      title="数据添加"
      :visible.sync="dialogVisible"
      width="30%"
      :before-close="handleClose">
      <el-form>
        <el-form-group>
          <el-form-item label-width="80px" label="编码">
            <el-input v-model="platform.gender"/>
          </el-form-item>
        </el-form-group>
        <el-form-group>
          <el-form-item label-width="80px" label="显示值">
            <el-input v-model="platform.department"/>
          </el-form-item>
        </el-form-group>
        <el-form-group>
          <el-form-item label-width="80px" label="所属类型">
            <!--  <el-input v-model="dataDict.type"/>-->
            <el-select  v-model="platform.export"  clearable placeholder="请选择" style="width: 280px">
              <el-option
                v-for="item in platform.options"
                :key="item.value"
                :label="item.label"
                :value="item.label">
              </el-option>
            </el-select>
          </el-form-item>
        </el-form-group>
       <!-- <el-form-group>
          <el-form-item label-width="80px" label="备注">
            <el-input v-model="platform.desc"/>
          </el-form-item>
        </el-form-group>-->
      </el-form>
      <span slot="footer" class="dialog-footer">
         <el-button type="primary" @click="sumbmitHandle">确定</el-button>
          <el-button @click="dialogVisible = false">取消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
  export default{

    name: "platform", data(){
      return {
        tableData: [],
        dialogVisible: false,
        platform: {
          id:'',
          gender: '',
          department: '',
          export: '',
          pick: ''
          , options: [{
            value: '选项1',
            label: 'city'
          }, {
            value: '选项2',
            label: 'packType'
          }],
          value: ''
        }


      }
    },mounted() {
      /*挂载结束之后*/
      var _this=this;
      this.axios({
        url:'http://localhost:3000/platform/list',
        method:'get'
      }).then(function (res) {
        _this.tableData=res.data;
      })
    },methods:{
      btnAddClick(){
        this.dialogVisible = true;
      },handleClose(){
        this.dialogVisible = false;
      },sumbmitHandle(){
        var _this=this;
        this.axios({
          url: 'http://127.0.0.1:3000/platform/add',
          method: 'get',
          params:{
            id: this.platform.gender,
            display:this.platform.department,
            type:this.platform.export,
           /* desc:this.platform.desc*/

          }
        }).then(function (res) {
          if (res.data.flag){
            _this.tableData=res.data.plat;
            _this.$message('添加成功')
            _this.dialogVisible = false;
          }else {
            alert('添加失败');
          }

        })
      }
    }
  }
</script>

<style scoped>

</style>

